<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>社医堂</title>
<link rel="stylesheet" type="text/css" href="../../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../../css/hui.css" />
    <link rel="stylesheet" type="text/css" href="../../../css/iconfont.css" />
</head>
<body>


<style type="text/css">
.hui-speed-dial ul li{width:20%;}

/* 必要的css  */
.hui-news-list{width:92%;margin:6px 0px 0px 10px;padding:6px;background-color:#fff;}
.hui-news-list li{position:relative; width:100%; border-bottom:1px solid #E4E3E6; overflow:hidden;}
.hui-news-list li:last-child{border:none;}
.hui-news-list li a{display:block; overflow:hidden; padding:15px 0px;}
.hui-news-list div{-webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box; word-break:break-word;}
.hui-news-list-l{width:68%; float:left; line-height:1.6em; padding-right:10px; font-size:16px;}
.hui-news-list-l span{color:#999999; font-size:11px;}
.hui-news-list-r{width:32%; float:right;}
.hui-news-list-r img{width:100%;}
.hui-news-list-titile{line-height:1.6em; font-size:16px;}
.hui-news-list-imgs{font-size:0px; padding-top:8px;}
.hui-news-list-imgs img{display:block; width:33.3%; float:left; -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box; word-break:break-word; padding-right:5px;}
.hui-news-list-img{font-size:0px; padding:8px 0px 5px 0px;}
.hui-news-list-img img{width:100%;}
.hui-news-list-info{color:#999999; font-size:11px; padding-top:8px; line-height:18px;}
.hui-speed-dial-text{line-height:20px;;}
.hui-speed-dial-icons img{width:40px;height:40px;border-radius:6px;;}
.iconfont{font-size:25px;}
.blue{color:#0066CC;}
</style>
<div class="hui-wrap">
	
	<div style="padding:10px;">
	    <div class="hui-swipe" id="swipe">
	    	<div class="hui-swipe-items"></div>
	    </div>
	</div>

	<div class="hui-speed-dial" style="background-color:#fff;margin-right:20px;margin-left:10px;width:95%;border-radius:6px;">
		<ul>
			<li onclick="toDetails('../shop/','index',2)"><div class="hui-speed-dial-icons"><img src="../../../image/menu/8.png" /></div><div class="hui-speed-dial-text">商城</div></li>
			<li onclick="toDetails('../shop/','index',2)"><div class="hui-speed-dial-icons"><img src="../../../image/menu/2.png" /></div><div class="hui-speed-dial-text">兑换</div></li>			
			<li onclick="toDetails('../doctor/','appointment',0)"><div class="hui-speed-dial-icons"><img src="../../../image/menu/up.png" /></div><div class="hui-speed-dial-text">记录</div></li>
			<li onclick="toDetails('../news/','list',1)"><div class="hui-speed-dial-icons"><img src="../../../image/menu/news.png" /></div><div class="hui-speed-dial-text">资讯</div></li>
			<li onclick="toDetails('../video/','list',2)"><div class="hui-speed-dial-icons"><img src="../../../image/menu/video.png" /></div><div class="hui-speed-dial-text">视频</div></li>
		</ul>
		<ul>
			<li onclick="toDetails('../up/','up',0)"><div class="hui-speed-dial-icons"><img src="../../../image/menu/note.png" /></span></div><div class="hui-speed-dial-text">预警</div></li>			
			<li onclick="toDetails('../up/','up_record',0,)"><div class="hui-speed-dial-icons"><img src="../../../image/menu/5.png" /></div><div class="hui-speed-dial-text">记录</div></li>
			<li onclick="toDetails('../up/','up_drug',0)"><div class="hui-speed-dial-icons"><img src="../../../image/menu/6.png" /></span></div><div class="hui-speed-dial-text">取药</div></li>
			<li onclick="toDetails('../up/','up_drug_record',1)"><div class="hui-speed-dial-icons"><img src="../../../image/menu/7.png" /></div><div class="hui-speed-dial-text">取药记录</div></li>
			<li onclick="toDetails('../up/','up_feizu',1)"><div class="hui-speed-dial-icons"><img src="../../../image/menu/10.png" /></div><div class="hui-speed-dial-text">肺阻</div></li>
		</ul>
	</div>
	
	
	<div style="background:#FFF;margin:6px 10px 0px;padding-left:5px;" class="hui-flex">
		<div style="height:46px; width:20px;" onclick="toDetails('../note/','list',3);">
			<img src="../../../image/spiker.png" width="20" style="padding:13px 0px;" />
		</div>
		<div class="hui-scroll-news" id="scrollnew1">
			
		</div>
	</div>
	
	<div class="hui-list" style="margin-top:6px;margin-left:10px;width:94%;">
		<ul>
			<li>
				<a href="javascript:void(0);" onclick="toDetails('../up/','up_record');">
		    		<div class="hui-list-text">最新上报  <span class="hui-icons hui-icons-right"></span></div>
		    	</a>
			</li>
			<span id="updata">
			
			</span>
			
		</ul>
	</div>	
	
	<div class="hui-list" style="margin-top:6px;margin-left:10px;width:94%;">
		<ul>
			<li onclick="toDetails('../news/','list',1);">
		    	<div class="hui-list-text"><strong>最新资讯</strong><span class="hui-icons hui-icons-right"></span></div>	
			</li>
		</ul>
	</div>
	<div class="hui-news-list">
	    <ul id="news"></ul>
	</div>	
	
	<div class="hui-list" style="margin-top:10px;margin-left:10px;width:94%;">
		<ul>
			<li onclick="toDetails('../video/','list',2);">				
		    	<div class="hui-list-text"><strong>最新视频</strong><span class="hui-icons hui-icons-right"></span></div>				
			</li>
		</ul>
	</div>
	<div class="hui-news-list">
	    <ul id="video"></ul>
	</div>
	
</div>

<script src="../../../script/hui.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../script/hui-swipe.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../script/api.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../script/stm.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../script//doT.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
apiready = function() {
    /*api.setRefreshHeaderInfo({
        visible : true,
        bgColor : 'rgba(0,0,0,0)',
        textColor : '#666',
        textDown : '下拉刷新',
        textUp : '释放刷新'
    }, function(ret, err) {
        api.refreshHeaderLoadDone();
    });*/
	home()
	islogin(1)
	
	
};

function slidefun(){
	var swipe = new huiSwpie('#swipe');
	swipe.autoPlay = true;
	swipe.run();
}



function home(){

	api.ajax({
        url  : $api.getStorage('geturl')+'&c=ajaxmember&a=home',
        method: 'post',
        data: {
            values: { 
                type : 2,
				userid : $api.getStorage('docid')
            }
        }
    },function(res, err){

        if (res) {	
            if (res.status==1) {
				
				//幻灯片
				var slide = ''
				for(i=0;i<res.data.slide.length;i++){
					slide += '<div class="hui-swipe-item"><img src="'+$api.getStorage('weburl')+res.data.slide[i].thumb+'"/></div>'
				}
				hui("#swipe div").html(slide)
				slidefun()
				
				//通知公告
				var note = ''
				for(i=0;i<res.data.note.length;i++){
					note += '<div class="hui-scroll-news-items" onclick="toDetails(\'../note/\',\'details\','+res.data.note[i].id+');">'+res.data.note[i].title+'</div>'					
				}
				hui("#scrollnew1").html(note)

				//数据上报
				var updata = ''
				for(i=0;i<res.data.updata.length;i++){
					updata += '<li style="height:80px">'					
					updata += '	<a href="javascript:void(0);" style="height:auto;">'
					updata += '		<div class="hui-list-text" style="height:auto">'
					updata += '			<div class="hui-list-text-content" style="line-height:33px;">'
					updata += '				<span class="hui-badge hui-primary">血糖：'+res.data.updata[i].bloodsugar+'</span>'
					updata += '				<span class="hui-badge hui-primary">血压：'+res.data.updata[i].bloodmin+'-'+res.data.updata[i].bloodmax+'</span>'
					updata += '				<span class="hui-badge hui-primary">血脂：'+res.data.updata[i].bloodlipid+'</span><br />'
					updata += '				<span style="color:#f00">'+jsDateDiff(res.data.updata[i].cltime)+' '+res.data.updata[i].clinterval+'测量数据</span>'
					updata += '			</div>'
					updata += '		</div>'
					updata += '	</a>'
					updata += '</li>'					
				}
				hui("#updata").html(updata)
				
				
				//新闻资讯
				var news = ''
				for(i=0;i<res.data.news.length;i++){
					var thumb = res.data.news[i].thumb
					if(thumb==''){
						thumb = '../../../image/news/1.jpg'
					}else{
						thumb = $api.getStorage('weburl')+thumb
					}
					news += '<li><a href="javascript:(0);" onclick="toDetails(\'../news/\',\'details\','+res.data.news[i].id+');"><div class="hui-news-list-l">'+res.data.news[i].title+'<br /><span>'+jsDateDiff(res.data.news[i].addtime)+'</span></div><div class="hui-news-list-r"><img src="'+thumb+'" /></div></a></li>'			
				}
				hui("#news").html(news)

				//视频新闻
				var video = ''
				for(i=0;i<res.data.video.length;i++){
					var thumb = res.data.video[i].thumb
					if(thumb==''){
						thumb = '../../../image/26.jpg'
					}else{
						thumb = $api.getStorage('weburl')+thumb
					}
					video += '<li><a href="javascript:(0);" onclick="toDetails(\'../video/\',\'details\','+res.data.news[i].id+');"><div class="hui-news-list-titile">'+res.data.video[i].title+'</div><div class="hui-news-list-img"><img src="'+thumb+'" /></div><div class="hui-news-list-info">'+jsDateDiff(res.data.video[i].addtime)+'</div></a></li>'
									
				}
				hui("#video").html(video)
				
            }else{
                api.toast({ msg:res.tip,location:'top' })
            }
        } else {
            alert( JSON.stringify( err ) );
        }
    }); 


}




</script>

</body>
</html>